# pyTeleMonBot installation and setup guide

## 🔌 Installation

To install this project:

```bash
  git clone https://github.com/orenlab/pytelemonbot.git
  cd ~/pytelemonbot
```

## 🪛 Configure bot

1. Run the CLI Setup Wizard (__mandatory stage__):

```bash
cd ~/pytelemonbot
python3 ./setup_bot.py
```

And follow the wizard's instructions.

This wizard will generate the necessary configuration files for you.
You can leave the steps with the default settings by simply pressing "Enter".

2. Set your local TZ in `Dockerfile`:

```dockerfile
ENV TZ="Asia/Yekaterinburg"
```

If needed, set log level and operational mode in `Dockerfile`:

```dockerfile
# run app
# !!! needed set log level:
#   - DEBUG
#   - INFO (default)
#   - ERROR
#   - CRITICAL
# !!! needed set pyTeleMonBot mode:
#   - dev
#   - prod (default)
CMD [ "/venv/bin/python3", "app/main.py", "--log-level=INFO", "--mode=prod" ]
```

## 💰 Run bot

To build a Docker image:

```bash
  cd ~/pytelemonbot
  docker build -t orenlab/pytelemonbot:latest .
```

To launch a Docker container:

```bash
  docker run -d -m 100M --restart=always --name=pytelemonbot orenlab/pytelemonbot:latest
```
Docker image size ~80,5 Мб.

## 🛠 Glances note

Please make sure, that Glances is running and set up to work in RESTful/API server mode. See official
docs:  [API (Restfull/JSON) documentation](https://github.com/nicolargo/glances/blob/support/glancesv3/docs/api.rst):

```bash
  glances -w --disable-webui
```

I use the [minimal](https://hub.docker.com/r/nicolargo/glances) official Docker image for my needs. See detail
here: [Glances Docker](https://github.com/nicolargo/glances/blob/support/glancesv3/docs/docker.rst)